package com.liunian.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liunian.subject.common.enums.IsDeletedFlagEnum;
import com.liunian.subject.infra.basic.entity.SubjectJudge;
import com.liunian.subject.infra.basic.mapper.SubjectJudgeMapper;
import com.liunian.subject.infra.basic.service.SubjectJudgeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
*
*/
@Service
public class SubjectJudgeServiceImpl extends ServiceImpl<SubjectJudgeMapper, SubjectJudge> implements SubjectJudgeService {

    @Resource
    private SubjectJudgeMapper subjectJudgeMapper;

    @Override
    public List<SubjectJudge> selectJudgeAnswer(long subjectId) {
        LambdaQueryWrapper<SubjectJudge> wrapper = new LambdaQueryWrapper<>();
        return subjectJudgeMapper.selectList(wrapper
                .eq(SubjectJudge::getSubjectId, subjectId)
                .eq(SubjectJudge::getIsDeleted, IsDeletedFlagEnum.UN_DELETED.getCode()));
    }

    @Override
    public Boolean saveJudge(SubjectJudge subjectJudge) {
        return this.save(subjectJudge);
    }
}
